//文章请求模块
import request from "@/utils/request";
//请求获取文章列表数据
export const getArticles = (params) => request({
    method:'get',
    url: '/v1_0/articles',
    params:params
})

//获取文章详情
export const getArticleInfoApi = (article_id) => request({
    method:'get',
    url: "/v1_0/articles/" + article_id,
})

//关注用户
export const addUserFollowedApi = (data) => {
    return request
        ({
            url: '/v1_0/user/followings',
            method: 'post',
            data:data
    })
}

//取消关注用户
export const deleteUserFollowedApi = (id) => {
    return request
        ({
            url: '/v1_0/user/followings/' + id,
            method: 'delete',
    })
}


//收藏文章
export const addArticleCollectApi = (data) => {
    return request
        ({
            url: '/v1_0/article/collections',
            method: 'post',
            data:data
    })
}

//取消收藏文章
export const deleteArticleCollectApi = (id) => {
    return request
        ({
            url: '/v1_0/article/collections/' + id,
            method: 'delete',
    })
}

//点赞文章
export const addLike = (target) => request({
    method:'POST',
    url: '/v1_0/article/likings',
    data: {
        target:target
    }
})

//取消点赞文章
export const deleteLike = (target) => request({
    method:'delete',
    url: `/v1_0/article/likings/${target}`,
    data: {
        target:target
    }
})


//获取文章品论或评论恢复
export const getCommentLIstApi = (params) => request({
    method:'get',
    url: '/v1_0/comments',
    params: params
    // {
    //     type:'',//评论类型，a-对文章(article)的评论，c-对评论(comment)的回复
    //     source:'',
    //     offset:'',
    //     limit:''
    // }
})

//点赞品论
export const addCommentZanApi = (id) => request({
    method:'post',
    url: '/v1_0/comment/likings',
    data: {
        target:id
    }
})

//取消点赞品论
export const delCommentZanApi = (id) => request({
    method:'delete',
    url: '/v1_0/comment/likings/' + id,
    
})


//发布文章评论或者发布评论回复
export const addCommentInfoApi = (data) => request({
    method: 'post',
    url: '/v1_0/comments',
    data
})

//
  